UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SwImvwLcbP+EYkrodCMhhxqZAY99r1xA+9wltIUz+00=' 
WHERE 
  key_id = '86d34411df534ede8dbd9b75f04f261ee81bb51187e7b057845f8026f86920ed' 
  AND (
    token = 'SwImvwLcbP+EYkrodCMhhxqZAY99r1xA+9wltIUz+00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047