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