UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7Rhu0+6OdYwczHz2J3io+ytlgRY0bA+WDYF+USpsZg=' 
WHERE 
  key_id = '025d4e34b5805c28ec7d602f19ff67ad98206d03c9df68f63c257f544633a17d' 
  AND (
    token = 'f7Rhu0+6OdYwczHz2J3io+ytlgRY0bA+WDYF+USpsZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043