UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZhqTn81kyyCkj8X2EdxU4KNgh9BwpgFWdUe7O93P5Zk=' 
WHERE 
  key_id = '326c8a1813323e59c0140c95d3c2754cf6ae531c13933e5080fb28601a22ac94' 
  AND (
    token = 'ZhqTn81kyyCkj8X2EdxU4KNgh9BwpgFWdUe7O93P5Zk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033