UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sRePYaARGg4nu0htaslzN3PRELmZHqeGG3U5ImW0LAk='
WHERE
key_id = '15fa994b7ff8be39a932b987e602887ca22a44799477a309209f5126a936baa0'
AND (
token = 'sRePYaARGg4nu0htaslzN3PRELmZHqeGG3U5ImW0LAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)