UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uCaSgkswvkMQN+qZRBosXyTp1sFravrR+cnIFHxhO3k='
WHERE
key_id = '791a33818c94854d1fc77751517d68203853d703883de314b06ca9552d7773a4'
AND (
token = 'uCaSgkswvkMQN+qZRBosXyTp1sFravrR+cnIFHxhO3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)