UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J5wJlFULuV4SABO9Co6Y/Xumt8SsZnRaEGlxS8yTDa8='
WHERE
key_id = 'e0057e4fca9ed5046603caae904437e3f670bd3c449347e4fa5ddc3527842efe'
AND (
token = 'J5wJlFULuV4SABO9Co6Y/Xumt8SsZnRaEGlxS8yTDa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)