UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u7Bil6wKEzKlBIxQFoiKdyWhoXgA8OhWT9mu0cw1TYU='
WHERE
key_id = '564778f5ce37968f62f0157694d4a68ea8bb4cc1f5e6b42a582da0ab877086c4'
AND (
token = 'u7Bil6wKEzKlBIxQFoiKdyWhoXgA8OhWT9mu0cw1TYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)