UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6GXEMarwj1R5aeGje+HSVQMCYZJzh936ZryVIn/4cK8=' 
WHERE 
  key_id = '596615287518e98c878b9074021ab5b88740428d685e6f664102bef85e3095df' 
  AND (
    token = '6GXEMarwj1R5aeGje+HSVQMCYZJzh936ZryVIn/4cK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052