UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bII08m1ElMvXImZdonxgxnqrQj0XLcuh6+yA1t2I3ZA=' 
WHERE 
  key_id = 'b59df7df812561852ce1c33a190ff0b53f7b212974aba1a178ee755919e7aaf3' 
  AND (
    token = 'bII08m1ElMvXImZdonxgxnqrQj0XLcuh6+yA1t2I3ZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067