UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2kQ2CnGPSKFAtUmoaHFFKffCGVq+BEeac33+4mg4ws='
WHERE
key_id = '3586a57dd614f7cf04b26e0a47ce7d8203964f3a20007f2628576d41f056897e'
AND (
token = 'a2kQ2CnGPSKFAtUmoaHFFKffCGVq+BEeac33+4mg4ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)