UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '783pDHUBpxOT7cVmq56m7m/9RGKJsMyi5bVofLtYoOU=' 
WHERE 
  key_id = 'f4f73fbe0a735dd5f20782d150273e939312318e810f742038045f5fee0a93cc' 
  AND (
    token = '783pDHUBpxOT7cVmq56m7m/9RGKJsMyi5bVofLtYoOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026