UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GsNjQ850xuUL7GHOjFyTeiDDreLvwrOzKRy8OglOHmE=' 
WHERE 
  key_id = '0f2a0252606ca617f69ef70c20fcea84a66a9217f1f2d3ff20c0dffc25b089e9' 
  AND (
    token = 'GsNjQ850xuUL7GHOjFyTeiDDreLvwrOzKRy8OglOHmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040