UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1CudV3qpZMrny9REnJP0M8Do08n8eDNWkUgBAbKveN4=' 
WHERE 
  key_id = 'f6781e5043dff850588b07c072ab3aee486738a7db9bb89855717cbda2d5190f' 
  AND (
    token = '1CudV3qpZMrny9REnJP0M8Do08n8eDNWkUgBAbKveN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021