UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y/PQVWNKPiRXMOpif7Yx2rhC6xu1+O2NPmlgKm3x44U='
WHERE
key_id = 'c2794ff1765c05d82175e198d47b77fe289013408b5cad575fc8671df09b6d6c'
AND (
token = 'Y/PQVWNKPiRXMOpif7Yx2rhC6xu1+O2NPmlgKm3x44U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)