UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2kYqUsYNTZAov2DkDuV+Eny+Ghzq8QqPj9vnOw3+vs=' 
WHERE 
  key_id = 'e0ac5d96a9b73b3cd20e15763c702822b72128b99791cd0772ea76e29287171c' 
  AND (
    token = 'n2kYqUsYNTZAov2DkDuV+Eny+Ghzq8QqPj9vnOw3+vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039