UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nzNRp0ihfIMbc6jo98To3ad3B++LLFm5pBVR4u3bXRo='
WHERE
key_id = '6946946fc4f760bff0ff8a28fc949da9f8838a24fa03323b27defe3f15fe1955'
AND (
token = 'nzNRp0ihfIMbc6jo98To3ad3B++LLFm5pBVR4u3bXRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)