UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P84c1DmyWvcG3oDMqM8lfGlzSUThYYP8ukhz7e2x6Z4='
WHERE
key_id = '4c952fa0b874ba8b2e1d5cefe5be3cfdcd798820415fe63a420313cc035a96ed'
AND (
token = 'P84c1DmyWvcG3oDMqM8lfGlzSUThYYP8ukhz7e2x6Z4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)