UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sakGxiv53dSCW75cKxvAQ5f+3OWdjST5Y8EoHXSwTjA=' 
WHERE 
  key_id = 'e50d885ee2a1a4f153aa06b6290f377393cb9bf98c8faf4ef2a0f845ab924985' 
  AND (
    token = 'sakGxiv53dSCW75cKxvAQ5f+3OWdjST5Y8EoHXSwTjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027