UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qSjlc9vBELfrT45KPAdRq11w0lCn56jpOOLVLOdT9pA='
WHERE
key_id = 'cd54af78a5493069babae76bf211b775963d0b65a8c9f36ab5a32be491e8b6a1'
AND (
token = 'qSjlc9vBELfrT45KPAdRq11w0lCn56jpOOLVLOdT9pA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)