UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1wy1KnqUcrbVx0CWwMihkp7qxlNPQSTpsKonCDqJmgE=' 
WHERE 
  key_id = '473c7b1c76fe75e5f6a6de7a67deff4aca080d44cd47cc0dcce4465d151b12bf' 
  AND (
    token = '1wy1KnqUcrbVx0CWwMihkp7qxlNPQSTpsKonCDqJmgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032