UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n3aSOKQ5WhY+hSGxF1JEmgO4omfdcCPqOdHAB58+1rE='
WHERE
key_id = 'c0a8c7313a8db9f272dc3c8fbbe5aaa8e24f14f88733389921f8feef34c43bff'
AND (
token = 'n3aSOKQ5WhY+hSGxF1JEmgO4omfdcCPqOdHAB58+1rE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)