UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DvWfkVmGzFiNmhhPhkpAgtPLOm/m/4ky4IKDN/osjQg=' 
WHERE 
  key_id = '959c49f0fed117e788dff69f8530ede5fb68f35e4839d45108044461dc339889' 
  AND (
    token = 'DvWfkVmGzFiNmhhPhkpAgtPLOm/m/4ky4IKDN/osjQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053