UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pson99r+ctiyUsPIP/GWGe2uUficbeb99kboD4EKfBE=' 
WHERE 
  key_id = '01c40b391cee67c3900b8e4217bb6429b0aa3174caff3b82ebba3dddbdc4e663' 
  AND (
    token = 'Pson99r+ctiyUsPIP/GWGe2uUficbeb99kboD4EKfBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015