UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kSqGakUrhcButZdPe9ELgG0xOaFewAoBWvkxz2GL6HA='
WHERE
key_id = 'b5633fc546166a193d0b1ca2305c3eb70c195015477f57c6b94c71705fd7b40f'
AND (
token = 'kSqGakUrhcButZdPe9ELgG0xOaFewAoBWvkxz2GL6HA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)