UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mn6jYoqNDNA/iwofaviAGBBWmhMaeTg7fsduqO270/Y=' 
WHERE 
  key_id = 'cca3a8877a9e1aa894092617632a6ef84014eb40fafb8b43f03b11eaa59f2d56' 
  AND (
    token = 'mn6jYoqNDNA/iwofaviAGBBWmhMaeTg7fsduqO270/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039