UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SsM50x7EFwjWUpar90q0PoIb1ZIf0wpvSkpF4gNMWUM='
WHERE
key_id = '8dbe963f29ebbe0f0c16270a113a49560e8abe5ce6b6e5da75010c5cbfc2a2cc'
AND (
token = 'SsM50x7EFwjWUpar90q0PoIb1ZIf0wpvSkpF4gNMWUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)