UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BFB1qFBAkCTbW2/xxoxpO7lUqc9qcI8zEO9wwVzdjug='
WHERE
key_id = '8f3d93afc78bfe196a37be8a1ac45911ec42bd627e3b002eb109511c9d1d9e87'
AND (
token = 'BFB1qFBAkCTbW2/xxoxpO7lUqc9qcI8zEO9wwVzdjug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)