UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XDwfso9ZKlhJxWW+FyUnH5BVaK1UU6iLs9MLe2HywX8='
WHERE
key_id = '29313c4ecb5a4b7c0f213047a89398be324deea5fcf455a43c753ca0541d47d4'
AND (
token = 'XDwfso9ZKlhJxWW+FyUnH5BVaK1UU6iLs9MLe2HywX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)