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