UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g9u3uEK5ms5B/DPxL7svli3WzBYJaRU6zLUELrXdRh8='
WHERE
key_id = 'af577467a727563765bbab030677d4890ab1ed7035dd1bb049d72a32ba1be9f6'
AND (
token = 'g9u3uEK5ms5B/DPxL7svli3WzBYJaRU6zLUELrXdRh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)