UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dyOVR2LNk4Nok8f3vl/FT7mVelm7s7cv57k5CuyMsTU='
WHERE
key_id = 'd68e383f565da95baf200efb00aa79bcc34b19898a361918a700c90a8c8a1261'
AND (
token = 'dyOVR2LNk4Nok8f3vl/FT7mVelm7s7cv57k5CuyMsTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)