UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8G4x88PiRV+4U/Uc2j6M5f4FRtg0mLlwyoIFqp24wOo='
WHERE
key_id = 'ea8530d854b1fa126e6f32aaa7a19889ef49dfb4b16aa664b891e6dbee5a2357'
AND (
token = '8G4x88PiRV+4U/Uc2j6M5f4FRtg0mLlwyoIFqp24wOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)