UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HMv8g+kduN8kXLaN6RIhpDK+mT3K23CMjMWMot4eibc=' 
WHERE 
  key_id = 'fb550c38e8e490771629348b75ec4ebf33027c9d6df4362717e71833faee19e9' 
  AND (
    token = 'HMv8g+kduN8kXLaN6RIhpDK+mT3K23CMjMWMot4eibc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030