UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1STLfneFhKEAPBFoY4Nw95zde0td67j7fl0c1OB5iw=' 
WHERE 
  key_id = 'fe4c03a720baa4ddd96558dc175555e7f97fd20fa9577ad54740941d6816c1e1' 
  AND (
    token = 'p1STLfneFhKEAPBFoY4Nw95zde0td67j7fl0c1OB5iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031