UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TenQ2C6r36lWp/BaQL925Y6vsSy+HzsVYQNHuPipKyw=' 
WHERE 
  key_id = '4eddb1a9156707f8235d75e1a48f739e81369f838e0db0379cf1f2d91915c925' 
  AND (
    token = 'TenQ2C6r36lWp/BaQL925Y6vsSy+HzsVYQNHuPipKyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026